/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Request;

import Request.RequestType;
import java.io.*;
import java.net.*;
import java.util.*;

import AccManager.UserProfile;

/**
 *
 * @author lcy
 */
public class LoginRequest extends Request implements Serializable {

    protected UserProfile _usr_profile;
    
    public LoginRequest(){
        super(RequestType.LOGIN);
        _usr_profile = null;
        InitCommComponents();
    }

    public LoginRequest(UserProfile profile){
        super(RequestType.LOGIN);
        _usr_profile = new UserProfile(profile);
        InitCommComponents();
    }

    public LoginRequest(LoginRequest request){

        super(RequestType.LOGIN);

        _usr_profile = new UserProfile(
                (UserProfile)(request.GetRequestContent()));
    }
    
    private void InitCommComponents(){
        
    }

    public UserProfile GetRequestContent(){
        return _usr_profile;
    }

    @Override
     public void SetLocalInetAddr(InetAddress addr){
          _local_ip_addr = addr;
          _usr_profile.SetUserIP(addr);
    }

    @Override
    public void SetLocalPort(int port){
        _local_port = port;
        _usr_profile.SetUserPort(port);
    }
}
